var periodMin = 30;
var getDayCount = function () {
  return Math.floor( (new Date("10 Nov 2012").getTime() - 
          new Date().getTime()) / (1000*60*60*24) + 1);
}

var updateEstimate = function() {
  var numOfDays = getDayCount();
  chrome.browserAction.setBadgeText({text: "" + numOfDays});
}

updateEstimate();

chrome.alarms.create({'periodInMinutes': periodMin});

chrome.alarms.onAlarm.addListener(function() {
    updateEstimate();
  }
);
